Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ReduceData::value safer #3421

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

WeiqunZhang
Copy link
Member

Although ReduceData::value is meant to be called only once, the user might call it multiple times. This will result in the wrong result for sum reduction because of how the value function is implemented. In this PR, we fix this defect by allowing the function be called multiple times.

Although ReduceData::value is meant to be called only once, the user might
call it multiple times. This will result in the wrong result for sum
reduction because of how the value function is implemented. In this PR, we
fix this defect by allowing the function be called multiple times.
@WeiqunZhang WeiqunZhang requested a review from atmyers July 13, 2023 04:30
@WeiqunZhang WeiqunZhang merged commit 2a555f8 into AMReX-Codes:development Jul 13, 2023
66 checks passed
@WeiqunZhang WeiqunZhang deleted the reduce_value branch July 13, 2023 16:29
WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this pull request Sep 15, 2023
In AMReX-Codes#3421, a change was made to avoid a common mistake of calling
ReduceData::value multiple times. Unfortunately, it breaks codes that using
one ReduceOps with multiple ReduceData objects. This PR fixes both cases.
WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this pull request Sep 15, 2023
In AMReX-Codes#3421, a change was made to avoid a common mistake of calling
ReduceData::value multiple times. Unfortunately, it breaks codes that using
one ReduceOps with multiple ReduceData objects. This PR fixes both cases.
WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this pull request Sep 15, 2023
In AMReX-Codes#3421, a change was made to avoid a common mistake of calling
ReduceData::value multiple times. Unfortunately, it breaks codes that using
one ReduceOps with multiple ReduceData objects. This PR fixes both cases.
ajnonaka pushed a commit that referenced this pull request Sep 15, 2023
In #3421, a change was made to avoid a common mistake of calling
ReduceData::value multiple times. Unfortunately, it breaks codes that
using one ReduceOps with multiple ReduceData objects. This PR fixes both
cases.

## Checklist

The proposed changes:
- [x] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants